"""Application bootstrap."""

from __future__ import annotations

import os
import sys

from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QApplication

from .qt_compat import cv2, ensure_pyqt_qt_plugin_path

from .ui.main_window import MainWindow

def main() -> None:
    ensure_pyqt_qt_plugin_path()
    try:
        cv2.setUseOptimized(True)
        cv2.setNumThreads(max(1, (os.cpu_count() or 1) - 1))
    except AttributeError:
        pass
    try:
        cv2.ocl.setUseOpenCL(True)
    except AttributeError:
        pass
    app = QApplication(sys.argv)
    app.setFont(QFont("Cascadia Code", 9))
    window = MainWindow()
    window.show()
    sys.exit(app.exec_())


if __name__ == "__main__":
    main()
